package com.atjava.webspider.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {
	
	public static SimpleDateFormat timeFormat ;
	
	public static SimpleDateFormat dateTimeFormat ;
	
	public static SimpleDateFormat dateFormatCN;
	
	public static String formatDataCN(Date d){
		if(dateFormatCN == null){
			dateFormatCN = new SimpleDateFormat("yyyy年MM月dd日");
		}
		return dateFormatCN.format(new Date());
	}

	
	public static String formatTime(Date d){
		if(timeFormat == null){
			timeFormat = new SimpleDateFormat("HH:mm:ss");
		}
		return timeFormat.format(d);
	}
	
	public static String formatDateTime(Date d){
		if(dateTimeFormat == null){
			dateTimeFormat = new SimpleDateFormat("yyyyMMddHHmmss");
		}
		return dateTimeFormat.format(d);
	}
	
	public static String currentTime(){
		return formatTime(new Date());
	}
	
	public static String currentDateTime(){
		return formatDateTime(new Date());
	}
}
